package com.aaa.inside.mapper;

import com.aaa.entity.inside.AllocationDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author aaa
 * @since 2020-12-05
 */
public interface AllocationDetailMapper extends BaseMapper<AllocationDetail> {
    @Select("select d.* from s_allocation_detail d join allocation a on d.pid=a.id\n" +
            "where a.allocationno=#{allocationno}")
    List<AllocationDetail> selectAllDetail(String allocationno);
    @Select("select d.* from s_allocation_detail d join allocation a on d.pid=a.id\n" +
            "where a.allocationno=#{allocationno}\n" +
            "and d.locatorcode=#{locatorcode}\n" +
            "and d.commoditybar=#{commoditybar}")
    AllocationDetail selectDeByaNoLBar(String allocationno, String locatorcode, String commoditybar);
    @Delete("delete s_allocation_detail from s_allocation_detail, allocation\n" +
            "where s_allocation_detail.pid=allocation.id\n" +
            "and allocation.allocationno=#{allocationno}")
    boolean deleteDetailByNo(String allocationno);

}
